package com.learning.dubbo.protocol.http.provider;

import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.apache.dubbo.remoting.http.servlet.DispatcherServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;

/**
 * ClassName: SpringBootDubboProviderApplication
 * Description: 服务端
 * Date: 2020/6/15 13:43 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
@Slf4j
@SpringBootApplication
@EnableDubbo(scanBasePackages = "com.learning.dubbo.protocol.http.provider")
public class DubboProtocolHttpProviderApplication {

    public static void main(String[] args) {
        SpringApplication.run(DubboProtocolHttpProviderApplication.class, args);
        log.info("~~~~~ DubboProtocolHttpProviderApplication 启动成功 ~~~~~~~");
    }


    @Bean
    public ServletRegistrationBean<DispatcherServlet> getServletRegistrationBean() {
        ServletRegistrationBean<DispatcherServlet> bean = new ServletRegistrationBean<DispatcherServlet>(new DispatcherServlet());
        bean.addUrlMappings("/*");
        bean.setLoadOnStartup(1);
        return bean;
    }

}